<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Processing.js test of min() (1)</title>
	<script type="text/javascript" src="../../../processing.js"></script> 
	<script type="text/javascript" src="../../init.js"></script> 
	<style type="text/css">
	html, body
	{
		background: #EEE;
		font-family: Arial;
		font-size: 13px;
		margin: 0;
		padding: 0;
	}
	h1
	{
		background: #385C85;
		color: #FFF;
		padding: 10px;
		padding-left: 20px;
		margin-top: 0px;
	}
	h1 a
	{
		color: #FFF;
	}
	h2
	{
		padding-left: 20px;
	}
	p
	{
		padding-left: 20px;
		line-height: 1.3em;
	}
	p a
	{
		color: #385C85;
	}
	canvas
	{
		margin: 10px 0;
	}
	pre
	{
		margin-left: 20px;
		margin-right: 20px;
		padding: 5px;
		background: #FFF;
		border-top: 1px solid #333;
		border-bottom: 1px solid #333;
	}
	div.ref-col
	{
		float: left;
		width: 32%;
	}
	</style>
</head>
<body>

<h1>
	<!-- name of your function and test description -->
	min() test (1)</h1>
	<h2>
	More than 2 arguments, argument type checking.</h2>
	<br />
	<p>
	<!-- copy paste your processing code below this script tag -->

	<script id="script" type="application/processing">
size(300,250);
background(50);

boolean errors=false;

int xcoord=5;
int xoff=10;
int ycoord=35;
int yinc=15;

fill(255,255,255);
text("min(-54, 23, -100)",xcoord,ycoord+=yinc);
int g = min(-54, 23, -100);
int g_exp=-100;
if (g_exp==g) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+g,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min(-54, 23, 234, -100)",xcoord,ycoord+=yinc);
int a = min(-54, 23, 234, -100);
int a_exp=-100;
if (a_exp==a) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+a,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min(10, 20, true)",xcoord,ycoord+=yinc);
int b = min(10, 20, true);
var b_exp=undefined;
if (b_exp==b) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+b,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min({ 9, -4, 230 }, 10)",xcoord,ycoord+=yinc);
float[] list = { 9, -4, 230 };
int c = min(list, 10 );
var c_exp=undefined;
if (c_exp==c) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+c,xcoord+xoff,ycoord+=yinc);

String errMsg="";
if (errors) {
	fill(255,0,0);
	errMsg="Some tests FAILED. See RED results.";
} else {
	fill(0,255,0);
	errMsg="All tests passed.";
}
text(errMsg,5,20);
	</script>
	<canvas id="display" style="width:200;height:100;"></canvas>
	<br />
	<b>Test written by <a href="http://zenit.senecac.on.ca/wiki/index.php/User:Mlam19">Matthew Lam</a>
	<pre style="border-style: dotted; border-width: 1px; background-color: #FFFFFF; padding: 2px; margin: 5px">
size(300,250);
background(50);

boolean errors=false;

int xcoord=5;
int xoff=10;
int ycoord=35;
int yinc=15;

fill(255,255,255);
text("min(-54, 23, -100)",xcoord,ycoord+=yinc);
int g = min(-54, 23, -100);
int g_exp=-100;
if (g_exp==g) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+g,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min(-54, 23, 234, -100)",xcoord,ycoord+=yinc);
int a = min(-54, 23, 234, -100);
int a_exp=-100;
if (a_exp==a) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+a,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min(10, 20, true)",xcoord,ycoord+=yinc);
int b = min(10, 20, true);
var b_exp=undefined;
if (b_exp==b) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+b,xcoord+xoff,ycoord+=yinc);

ycoord+=yinc;

fill(255,255,255);
text("min({ 9, -4, 230 }, 10)",xcoord,ycoord+=yinc);
float[] list = { 9, -4, 230 };
int c = min(list, 10 );
var c_exp=undefined;
if (c_exp==c) {
	fill(0,255,0);
} else {
	fill(255,0,0);
	errors=true;
}
text(""+c,xcoord+xoff,ycoord+=yinc);

String errMsg="";
if (errors) {
	fill(255,0,0);
	errMsg="Some tests FAILED. See RED results.";
} else {
	fill(0,255,0);
	errMsg="All tests passed.";
}
text(errMsg,5,20);
	</pre>
	<br />

</body>
</html>

